<?php
/**
 * Created by PhpStorm.
 * User: laodage
 * Date: 18-12-3
 * Time: 上午11:41
 */

require_once __DIR__ . '/vendor/autoload.php';


use Workerman\Worker;
use Workerman\Lib\Timer;
use Workerman\WebServer;
//use App\JdService\jdService;
use App\JdApi\jdConfOrder;

//接受token
$worker = new WebServer('http://0.0.0.0:8282');
$worker->name = 'jdong';
$worker->addRoot('jdong.10ss.net',realpath(__DIR__.'/Application/Web/'));
$worker->count = 2;

//创建新订单
$worker = new WebServer('http://0.0.0.0:8383');
$worker->name = 'jdong';
$worker->addRoot('jdong.10ss.net',realpath(__DIR__.'/Application/Web/djsw/'));
$worker->count = 2;

//jd_confirm_order
$confirmWorker = new Worker();
$confirmWorker->name = 'confirm_order';
$confirmWorker->count = 1;
$confirmWorker->onWorkerStart = function() {
    $confirmOrderClass = new jdConfOrder();
    Timer::add(5, array($confirmOrderClass, 'run'));
};

Worker::$stdoutFile = '/tmp/stdout.log';
// 运行worker
Worker::runAll();